import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:xin_he/page/home/model/xin_he_goods_item_entity.dart';

import '../../../utils/xh_styles.dart';
import '../../../utils/xin_he_image.dart';
import '../../shopping_car/models/xin_he_goods_model.dart';
class XinHeGoodsGridWidget extends StatelessWidget {
   XinHeGoodsGridWidget({Key? key,required this.model,required this.onTapCallback}) : super(key: key);
  VoidCallback onTapCallback;
  XinHeGoodsItemEntity model;
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      child: Column(
        children: [

          Container(
            width: (Get.width-30-10.5)*0.5,
            height: (Get.width-30-10.5)*0.5,
            decoration: BoxDecoration(
              color: Colors.transparent,
              borderRadius: BorderRadius.circular(5),
            ),
            child:   XinHeNetImage(url: model.iconPath??'',placeholderUrl: 'assets/images/home/tmp.png',) ,
          ),

          const SizedBox(height: 0,),
          Container(
            alignment: Alignment.centerLeft,
            width: (Get.width-30-10.5)*0.5,
            // color: Colors.green,
            padding: const EdgeInsets.only(left: 10,right: 20,top: 10.5,bottom: 5),
            child: Text(
              (model.name??'').replaceAll("", "\u{200B}"),
              style: TextStyle(fontSize: 13,color: XinHeColor('#2B3131')),
              softWrap: true,
              maxLines: 2,
              overflow: TextOverflow.ellipsis,
            ),
          ),

          ///  价格
          Expanded(
            child: Container(
              alignment: Alignment.bottomCenter,
              padding: const EdgeInsets.only(left: 10,right: 20,top: 0.5),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.end,
                children: [
                  Container(
                    child: Column(children: [
                      SizedBox(height: 7,),
                      RichText(
                          text: TextSpan(children: [
                            ///￥
                            TextSpan(
                              text: '￥',
                              style: TextStyle(
                                color: XinHeColor('#E84128'),
                                fontSize: 9,
                                fontWeight: FontWeight.w400,
                              ),
                            ),

                            ///
                            TextSpan(
                              text: '${model.price??''}',
                              style: TextStyle(
                                color: XinHeColor('#E84128'),
                                fontSize: 16,
                                fontWeight: FontWeight.w500,
                              ),
                            ),


                          ]
                          )),
                      const Spacer(),
                    ],),
                  ),
                  const Spacer(),
                  // Container(
                  //   child:  Column(
                  //     mainAxisAlignment: MainAxisAlignment.start,
                  //     children: [
                  //       GestureDetector(
                  //         onTap:(){
                  //           // logic.addGoodsToCartAction(XinHeGoodsModel());
                  //           if(onTapCallback !=null){
                  //             onTapCallback!();
                  //           }
                  //         },
                  //         child: const Padding(
                  //           padding: EdgeInsets.only(left: 8),
                  //           child: XinHeAssetImage('assets/images/home/add.png',width: 22,height: 22,),
                  //         ),
                  //       ),
                  //       Spacer()
                  //     ],
                  //   ),
                  // )
                ],
              ),
            ),
          ),
          // Container(color: Colors.blue,height: 18,)
        ],
      ),
    );
  }
}
